package cn.itcast.classSM.domain;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

@Entity
@Table(name="T_CLAZZ")
//班级
public class Clazz {
	
	@Id
	@GeneratedValue(strategy=GenerationType.IDENTITY)
	@Column(name = "C_CID")
	private Integer cid; //主键id
	@Column(name = "C_NAME")
	private String cname; //班级名称
	@Column(name = "C_NUMBER")
	private Integer cnumber; //人数
	@Column(name = "C_START_TIME")
	@Temporal(TemporalType.DATE)
	private Date startTime; //开班时间
	@Column(name = "C_END_TIME")
	@Temporal(TemporalType.DATE)
	private Date endTime; //毕业时间
	@Column(name = "C_TYPE")
	private Integer ctype; //班级类型
	@Column(name = "C_STATE")
	private Integer cState; //班级状态
	
	@OneToMany(mappedBy = "mcmClazz")
	private Set<MainCheckMessage> mainCheckMessages = new HashSet<MainCheckMessage>();
	
	@ManyToOne
	@JoinColumn(name = "C_CLAZZ_USER")
	private User cuser; //班主任
	
	@OneToOne(targetEntity = ClassRoom.class)
	@JoinColumn(name="C_CLASS_ROOM")
	private ClassRoom classRoom; //教室
	
	public Integer getCid() {
		return cid;
	}
	public void setCid(Integer cid) {
		this.cid = cid;
	}
	public String getCname() {
		return cname;
	}
	public void setCname(String cname) {
		this.cname = cname;
	}
	public Integer getCnumber() {
		return cnumber;
	}
	public void setCnumber(Integer cnumber) {
		this.cnumber = cnumber;
	}
	public Date getStartTime() {
		return startTime;
	}
	public void setStartTime(Date startTime) {
		this.startTime = startTime;
	}
	public Date getEndTime() {
		return endTime;
	}
	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}
	public Integer getCtype() {
		return ctype;
	}
	public void setCtype(Integer ctype) {
		this.ctype = ctype;
	}
	public Integer getcState() {
		return cState;
	}
	public void setcState(Integer cState) {
		this.cState = cState;
	}
	public Set<MainCheckMessage> getMainCheckMessages() {
		return mainCheckMessages;
	}
	public void setMainCheckMessages(Set<MainCheckMessage> mainCheckMessages) {
		this.mainCheckMessages = mainCheckMessages;
	}
	public User getCuser() {
		return cuser;
	}
	public void setCuser(User cuser) {
		this.cuser = cuser;
	}
	public ClassRoom getClassRoom() {
		return classRoom;
	}
	public void setClassRoom(ClassRoom classRoom) {
		this.classRoom = classRoom;
	}
	@Override
	public String toString() {
		return "Clazz [cid=" + cid + ", cname=" + cname + ", cnumber=" + cnumber + ", startTime=" + startTime
				+ ", endTime=" + endTime + ", ctype=" + ctype + ", cState=" + cState + ", mainCheckMessages="
				+ mainCheckMessages + ", cuser=" + cuser + ", classRoom=" + classRoom + "]";
	}
	
}
